<?php



namespace App\Services\Business\Models;

use App\Services\Business\Models\Base;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Services\Member\Models\User;

class Comment extends Base
{
    use SoftDeletes,HasFactory;

    protected $table = 'comment';

    protected $fillable = [
        'user_id', 'commentable_id', 'original_content', 'render_content','commentable_type','parent_id','reply_id','content','thumbsup_count','children_count'
    ];

    protected $hidden = [
        'deleted_at',
    ];
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public function reply()
    {
        return $this->belongsTo(Comment::class, 'reply_id', 'id')->with(['user:id,nick_name']);
    }

    public function commentable()
    {
        return $this->morphTo();
    }





}
